Class: Jbr::Client
Constant Summary collapse
- LOOKUP =
<<~GRAPHQL.freeze query($searchTerm: String!) { clientPhones(first: 1, searchTerm: $searchTerm) { nodes { client { id updatedAt clientProperties { nodes { id address { street city province postalCode } }} } } } } GRAPHQL
- CREATE =
<<~GRAPHQL.freeze mutation($input: ClientCreateInput!) { clientCreate(input: $input) { client { id clientProperties(first: 1) { nodes { id } } } userErrors { message } } } GRAPHQL
- CREATE_PROPERTY =
<<~GRAPHQL.freeze mutation propertyCreateMutation($clientId: EncodedId!, $input: PropertyCreateInput!) { propertyCreate(clientId: $clientId, input: $input) { properties { id } userErrors { message } } } GRAPHQL
Instance Attribute Summary collapse
-
#property_id ⇒ Object
readonly
Returns the value of attribute property_id.
Attributes inherited from Resource
Instance Method Summary collapse
-
#create_with(params = {}) ⇒ Client
Create a client instance with the provided attributes.
- #find_or_create_by(phone:) ⇒ Object
Methods inherited from Resource
Constructor Details
This class inherits a constructor from Jbr::Resource
Instance Attribute Details
#property_id ⇒ Object (readonly)
Returns the value of attribute property_id.
29 30 31 |
# File 'lib/jbr/client.rb', line 29 def property_id @property_id end |
Instance Method Details
#create_with(params = {}) ⇒ Client
Create a client instance with the provided attributes.
38 39 40 |
# File 'lib/jbr/client.rb', line 38 def create_with(params = {}) self.tap { @create_params = params } end |
#find_or_create_by(phone:) ⇒ Object
42 43 44 45 |
# File 'lib/jbr/client.rb', line 42 def find_or_create_by(phone:) find_by_phone(phone) || create self end |