Giter Site home page Giter Site logo

amorail's People

Contributors

alekseenkoss77 avatar alexandershvaykin avatar evserykh avatar ivanovaleksey avatar lhydra avatar palkan avatar vladimirmikhailov avatar zloypotroh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

amorail's Issues

Не работает обновление сделки

Нахожу сделку.

lead = Amorail::Lead.find LEAD_ID

Хочу поменять два параметра (responsible_user_id и status_id).
Пытаюсь это сделать двумя способами.
Оба способа падают с ошибками.

lead.update! responsible_user_id: MANAGER_ID, status_id: STATUS_ID
#=> Amorail::Entity::NotPersisted: Amorail::Entity::NotPersisted

# or

lead.responsible_user_id = MANAGER_ID
lead.status_id = STATUS_ID
lead.save!
#=> Amorail::Entity::InvalidRecord: Amorail::Entity::InvalidRecord

В какую сторону смотреть?

Кастомные поля на русском

А как быть с полями на русском? Дополнительное amo_property :xxx не думаю что справится. Есть ли сейчас поддержка кастомных полей на русском?

undefined method `+' for nil:NilClass

Привет, настроил отправку новых записей из приложения в АМО, на локальной машине все работает и напрямую и через воркер, на продакшн сервере выдает ошибку

undefined method `+' for nil:NilClass

вот сам код

contact = AmoContact.new(
        name: @customer.name + " " + @customer.surname,
        phone: @customer.phone,
        bday: @customer.bday,
        address: @customer.address
      )
      contact.save!

Вот эта строчка не при чем:

name: @customer.name + " " + @customer.surname,

в переменных тоже 100% есть данные, вот хеш с параметрами с той же страницы, что и ошибка

Parameters:

{"utf8"=>"✓",
 "authenticity_token"=>"jCgmFBsn2GBK/uq+GbkOPztzExIlcq/qtxmtvg7tTBn0e57pu2V+NvlUBVZ655ZXdV2l16LV1nRL0YlzffufBw==",
 "customer"=>{"name"=>"Aleksey", "surname"=>"Paschenko", "phone"=>"********", "address"=>"Bogatyrova", "job"=>"", "diler"=>"0", "bday"=>"26.07.2017", "note"=>""},
 "commit"=>"Create Customer"}

ругается на contact.save!

Изменение нескольких сделок за раз (массивом)

Мне нужно изменить несколько сделок (или создать несколько задач).

lead_1 = Amorail::Lead.find 1
# some modifications
lead.save

lead_2 = Amorail::Lead.find 2
# some modifications
lead.save

В данном примере будет два (два же?) запроса к AmoCRM API.
Можно ли данные запросы объединить в один?
AmoCRM API поддерживает мультиизменение в одном запросе.
Поддерживает ли сие Amorail?

Find returns false

Hi @palkan,

Today I have faced with an issue:

Amorail::Lead.find ANY_NONEXISTENT_ID
=> false

I don't it is convenient to return false from #find because one waits for lead instance (if given lead is exists) or nil.

It seems like it occurs because of Entity#handle_response returns false.

My proposal is to return nil instead of false.

What do you think?

Amorail::AmoBadRequestError

Уже некоторое время я стал постоянно получать Amorail::AmoBadRequestError на любые запросы.

Буду благодарен за любую помощь.

Авторизация не работает

Привет,

Я завёл в CRM интеграцию.
Получил из админки Secret Key.
Дальше передаю имейл пользователя-админа, Secret Key (как API key), endpoint.
(Integration, Authorization коды, которые выдаёт админка, не использую.)
И получаю Not Authenticated.

Буду благодарен за помощь!

Реализации oAuth

Они сейчас поменяли систему авторизации на oAuth, я хочу реализовать в геме упрощенный вариант, думаю как лучше сделать, сейчас сохраняю access_token и refresh_token в файл, затем проверяем не протух ли токен и в случае надобности - обновляем его. Но думаю может лучше добавить настройку и например, связывать гем с базой приложения, и коды напрямую записывать туда?

По документации тянется неактуальная версия гема

Добрый день, возможно вы забыли добавить тег на свежую версию) Пробовали с коллегой стягивать гем и он был без авторизации oauth, версия шла 0.6.1. Стянулось свежее, только когда гвоздями ветку master прописала.

Неразобранное

Amorail работает с данным функционалом? Если нет, то можно добавить, а то крайне нужна вещь :)

Custom fields

Hi.
Sorry to trouble you, but have an issue with custom fields, that not clear for me.

So from you guide I understand that I need to add custom fields in secrets.yaml.

"AmoCRM is using "custom_fields" architecture, to get all information for your account, you can find properties and set up configuration manually in config/secrets.yml."

I make a lot of attempts with no luck.
In final I got this secrets yaml:

amorail:
      usermail: 'myusername'
      api_key: 'mytoken'
      api_endpoint: 'myAMOdomain'
      custom_fields:
        contacts:
          -
            id: "1628873"
            name: "user_hash"
            code: ""
            multiple: "N"
            type_id: "1"
            disabled: "0"
          -
            id: "1634385"
            name: "lp_db_id"
            code: ""
            multiple: "N"
            type_id: "2"
            disabled: "0"

And still have problems with as example get Contact.

  1. Contact "[email protected]" have custom field lp_db_id and empty user_hash
    result:
Amorail::Contact.find_by_query("[email protected]")
=> [#<Amorail::Contact:0x007fc019f909a8 @last_modified=1435166323, @id=65601902, @name="test", @date_create=1435166279, @responsible_user_id=271104, @company_name="", @linked_company_id="0", @email="[email protected]">]

So we got Contact but without lp_db_id

  1. Contact "[email protected]" have custom field lp_db_id and user_hash
    result:
Amorail::Contact.find_by_query("[email protected]")
=> key not found: "code"

In this case we got an error.

What I'm doing wrong? Thinks that may be something not good in yaml file.
Thanks.

There was an error while trying to load the gem 'amorail' (rspec-test environment)

I'm getting this error message:

RAILS_ENV=test bundle exec rspec spec/requests/home_applications_spec.rb -e "GET /score/"

/home/manuel/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'amorail'. (Bundler::GemRequireError)
Gem Load Error is: uninitialized constant Amorail::Lead

The Amorail:Lead is called from the ops_lead.rb file. Even if add "require 'amorail'" to the file the code works fine on development and production but no when I try to run a test.

UPDATE

We can close this one. All was an error in my PATH.

Code 200 but errors in response

Hi @palkan,

recently I received a response with status 200 but there was errors inside

{"response"=>{"leads"=>{"update"=>{"errors"=>{"1572277"=>"Last modified date is older than in database"}}}, "server_time"=>1499868971}}

I just didn't specify last_modified attribute on update.

The problem is really tricky because one receives 200 (and Amorail treats it as a successful response) but object is not actually saved.

What do you think, can we deal with it somehow?

Динамический config

Есть n аккаунтов амо, во все нужно писать события. Есть ли сейчас возможность обойтись без config, а задавать

usermail: '[email protected]'
api_key: '75742b166417fe32ae132282ce178cf6'
api_endpoint: 'https://test.amocrm.ru'

динамически.

Raw search method

Hi @palkan,

It is necessary sometimes to be able to find all entities using limit_rows and limit_offset or to search by type.

For now I use the following dirty solution:

Amorail::Lead.instance_eval do
  def list(params = {})
    response = client.safe_request(
      :get,
      remote_url('list'),
      **params
    )
    load_many(response)
  end
end

I would like to have a method with similar functionality out of the box.
We can name some more AR-like, for instance, where.

What do you think?

Создание custom_fields

Привет! Подскажите пожалуйста, как отправлять кастомные поля при создании lead?
Мой пример не работает(
Если не указывать поле custom_fields все работает отлично.
У моего поля тип "Текст".

lead = Amorail::Lead.new(
  name:  "Example Lead",
  tags: "IT, Sales",
  price: 100,
  status_id: Amorail.properties.leads.statuses[
    Rails.application.secrets.amoparams['lead_status']
  ].id,
  custom_fields: [{
    :id => '1778775',
    :values => ['test']
  }]
)

lead.save!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.